using System;
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.UI;

/// <summary>
/// 玩家UI界面
/// </summary>
public class PlayerView : MonoBehaviour
{
    [Header("经验和金币")]
    [SerializeField] private TMP_Text playerExpUIText;               // 等级
    [SerializeField] private TMP_Text playerCoinsUIText;             // 金币
    
    [Header("血条和经验条")]
    [SerializeField] private Image playerHealthSlider;               // 玩家血条
    [SerializeField] private Image playerExpSlider;                  // 玩家经验条

    /// <summary>
    /// 更新UI界面
    /// </summary>
    /// <param name="player"></param>
    public void UpdateView(Player player)
    {
        playerCoinsUIText.text = player.GetPlayerCoins().ToString();
        playerExpUIText.text = player.GetPlayerLv().ToString();
        
        playerHealthSlider.fillAmount = player.GetPlayerHealth();
        playerExpSlider.fillAmount = player.GetPlayerExp();
    }
}
